package com.hb.demo.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hb.demo.entity.AdminUser;
import com.hb.demo.dao.AdminUserMapper;
import com.hb.demo.service.AdminUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统用户中心表 服务实现类
 * </p>
 *
 * @author zhaojk
 * @since 2021-08-14
 */
@Service
public class AdminUserServiceImpl extends ServiceImpl<AdminUserMapper, AdminUser> implements AdminUserService {

    @Override
    public boolean exists(String uname) {
        QueryWrapper<AdminUser> query = Wrappers.query();
        query.eq("uname", uname).eq("delete_flag", 0);
        return baseMapper.selectCount(query) > 0;
    }

    @Override
    public AdminUser getByUsername(String username) {
        return baseMapper.getByUsername(username);
    }
}
